# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Fabian Schoelzel <myfirstname.mylastname@googlemail.com>
# Contributor: funkyou <spamopfer@nickname.berlin.de>
# Contributor: tardo <tardo@nagi-fanboi.net>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Gustavo Alvarez <sl1pkn07@gmail.com>

pkgname=mlt
pkgver=7.20.0
pkgrel=2
pkgdesc='An open source multimedia framework'
arch=(loong64 x86_64)
url='https://www.mltframework.org'
license=(GPL)
depends=(gcc-libs
         glibc
         libebur128)
optdepends=('ffmpeg: ffmpeg plugin'
            'fftw: plus plugin'
            'fontconfig: gdk plugin'
            'frei0r-plugins: for additional effects'
            'gdk-pixbuf2: gdk plugin'
            'glib2: gdk plugin'
            'jack: JACK sound output plugin'
            'ladspa: LADSPA plugins'
            'libepoxy: opengl plugin'
            'libexif: auto rotate plugin'
            'libglvnd: opengl plugin'
            'libsamplerate: libavresample plugin'
            'libvorbis: vorbis plugin'
            'libx11: SDL1 plugin'
            'libxml2: XML plugin'
            'movit: opengl plugin'
            'opencv: openCV plugin'
            'qt5-base: QT5 plugins'
            'qt5-svg: Qt5 plugins'
            'qt6-base: Qt6 plugin'
            'qt6-5compat: Qt6 plugin'
            'qt6-svg: Qt6 plugin'
            'pango: gdk plugin'
            'python: python bindings'
            'rtaudio: rtaudio plugin'
            'rubberband: audio pitch plugin'
            'sdl2: SDL2 plugin'
            'sdl_image: SDL1 plugin'
            'sdl12-compat: SDL1 plugin'
            'sox: SOX (Audio Swiss Army Knife) plugin'
            'vid.stab: video stabilize plugin'
            'zlib: glaxnimate plugin')
makedepends=(cmake
             eigen
             ffmpeg
             frei0r-plugins
             gdk-pixbuf2
             imagemagick
             jack
             ladspa
             libdv
             libexif
             libsamplerate
             movit
             opencv
             pango
             python
             qt5-svg
             qt6-5compat
             qt6-svg
             rtaudio
             rubberband
             sox
             sdl_image
             swig
             vid.stab)
source=(https://github.com/mltframework/mlt/releases/download/v$pkgver/mlt-$pkgver.tar.gz
        https://github.com/mltframework/mlt/commit/80946f7a.patch)
sha256sums=('7472372b31f76b2eb0ac66c756391be7cb859a3a779c97ccb7dcf7086ac9d816'
            '6bedc2178a7906d9030af98fe7ad1e22ade491dc073afab18eb0e6911bbf84fb')

prepare() {
  patch -d $pkgname-$pkgver -p1 < 80946f7a.patch # Support rtaudio 6
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DMOD_OPENCV=ON \
    -DMOD_GLAXNIMATE=ON \
    -DMOD_QT6=ON \
    -DSWIG_PYTHON=ON
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
